<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c' %>

<c:url value="/recordsP.html" var="recordsUrl"/>
<c:url value="/createP.html" var="addUrl"/>
<c:url value="/updateP.html" var="editUrl"/>
<c:url value="/deleteP.html" var="deleteUrl"/>
<c:url value="/records1.html" var="populatePID"/>

<html>
<head>
	<link rel="stylesheet" href="css/stylekram.css" type="text/css" />
	<link rel="stylesheet" href="css/customkram.css" type="text/css" />
	<script type="text/javascript" src="js/jquery-1.6.js"></script>
	<script type="text/javascript" src="js/customProject.js"></script>
	
	<title>Assign Project</title>
	
	<script type='text/javascript'>
	$(function() {
		// init
		urlHolderP.records = '${recordsUrl}';
		urlHolderP.add = '${addUrl}';
		urlHolderP.edit = '${editUrl}';
		urlHolderP.del = '${deleteUrl}';
		urlHolderP.populate = '${populatePID}';
		loadTableP();
		
		$('#newBtnP').click(function() { 
			toggleFormsP('new');
			toggleCrudButtonsP('hide');
		});
		
		$('#editBtnP').click(function() { 
			
			if (hasSelectedP()) {
				
				toggleFormsP('edit');
				toggleCrudButtonsP('hide');
				fillEditFormP();
			}
		});
		
		$('#reloadBtnP').click(function() { 
			loadTableP();
		});

		$('#deleteBtnP').click(function() {
			if (hasSelectedP()) { 
				submitDeleteRecordP();
			}
		});
		
		$('#newFormP').submit(function() {
			event.preventDefault();
			submitNewRecordP();
		});
		
		$('#editFormP').submit(function() {
			event.preventDefault();
			//alert(submitUpdateRecordP);
			submitUpdateRecordP();
		});

		$('#closeNewFormP').click(function() { 
			toggleFormsP('hide'); 
			toggleCrudButtonsP('show');
		});
		
		$('#closeEditFormP').click(function() { 
			toggleFormsP('hide'); 
			toggleCrudButtonsP('show');
		});
	});
	</script>
</head>

<body>
	<div class="ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix">
		<a class="ui-jqgrid-titlebar-close HeaderButton" href="javascript:void(0)" role="link" style="right: 0px;">
		<span class="ui-icon ui-icon-circle-triangle-n"></span>
		</a>
	<span class="ui-jqgrid-title">Assign Project</span>
</div>
	
	<table id='tableUsersP'>
		<caption></caption>
		<thead>
			<tr>
				<th></th>
				<th>Username</th>
				<th>First Name</th>
				<th>Last Name</th>
				<th>Project</th>
			</tr>
		</thead>
	</table>
	
	<div id='controlBarP'>
		<!--  <input type='button' value='New' id='newBtn' />
		<input type='button' value='Delete' id='deleteBtn' />
		<input type='button' value='Edit' id='editBtn' />
		<input type='button' value='Reload' id='reloadBtn' />
		-->
		<input type='button' value='Edit' id='editBtnP' />
	</div>
	
	<div id='newFormP'>
		<form>
  			<fieldset>
				<legend>Create New Record</legend>
				<label for='newUsername'>Username</label><input type='text' id='newUsernameP'/><br/>
				<label for='newPassword'>Password</label><input type='password' id='newPasswordP'/><br/>
				<label for='newFirstName'>First Name</label><input type='text' id='newFirstNameP'/><br/>
				<label for='newLastName'>Last Name</label><input type='text' id='newLastNameP'/><br/>
				<label for='newProjectP'>Project</label>
					<select id='newProjectP'>
						<option value='1'>P1</option>
						<option value='2' >P2</option>
						<option value='3' >P3</option>
						<option value='4'>P4</option>
						<option value='5' >P5</option>
						<option value='6' >P6</option>
						<option value='7'>P7</option>
						<option value='8' >P8</option>
						<option value='9' >P9</option>
						<option value='10' >P10</option>
					</select>
					
  			</fieldset>
			<input type='button' value='Close' id='closeNewFormP' />
			<input type='submit' value='Submit'/>
		</form>
	</div>
	
	<div id='editFormP'>
		<form>
  			<fieldset>
				<legend>Assign Project</legend>
				<input type='hidden' id='editUsernameP'/>
				<input type='hidden' id='editFirstNameP'/>
				<input type='hidden' id='editLastNameP'/>
		
				<label for='editProjectP'>Project</label>
					<select id='editProjectP'>
						<!-- <option value='1'>P1</option>
						<option value='2' >P2</option>
						<option value='3' >P3</option>
						<option value='4'>P4</option>
						<option value='5' >P5</option>
						<option value='6' >P6</option>
						<option value='7'>P7</option>
						<option value='8' >P8</option>
						<option value='9' >P9</option>
						<option value='10' >P10</option> -->
					</select>
					<input type='hidden' id='editRoleP' />		
					
			</fieldset>
			
			<input type='button' value='Close' id='closeEditFormP' />
			<input type='submit' value='Submit'/>
		</form>
	</div>
	
</body>
</html>